Skip to content

Clarify directory and filename wildcards in extraction mappings - #1344

Open
xuu33030 wants to merge 1 commit into
python-babel:masterfrom
xuu33030:docs/286-extraction-glob-patterns
Open

xuu33030 wants to merge 1 commit into
python-babel:masterfrom
xuu33030:docs/286-extraction-glob-patterns

Conversation

@xuu33030

Copy link
Copy Markdown

Summary

Closes #286 by clarifying the existing extraction-pattern semantics, without changing matching behavior.

** includes one or more filename characters, while **/ can match zero directory levels without consuming the filename prefix. Therefore **._*.py does not match ._module.py or pkg/._module.py; **/._*.py does.

  • Document the distinction, with the working ignore rule placed before the Python extraction rule.
  • Correct the description of *: it matches one or more characters, not an empty string.
  • Keep the pathmatch() docstring consistent and add parametrized coverage of the documented behavior.

The current semantics date back to the original pathmatch implementation; this deliberately avoids a potentially incompatible change to extraction mappings.

Verification

On CPython 3.13.5:

  • python -m pytest -q tests/test_util.py babel/util.py tests/messages/test_extract.py tests/messages/test_extract_python.py tests/messages/test_js_extract.py tests/messages/test_jslexer.py95 passed.
  • ruff check babel/util.py tests/test_util.py (0.14.10) — passed.
  • git diff --check — passed.
  • An additional temporary-directory check executed extract_from_dir() on root-level and nested ._module.py files plus a normal pkg/module.py: the reported pattern extracted all four files, while the documented replacement extracted only the normal file. These are behavioral documentation tests, not a claim of a production-code red/green fix.

Sphinx 9.1.0 strict HTML builds were run against both this branch and an unmodified archive of base commit 6ba6701. Both reported the same five existing diagnostics: extract_javascript docstring indentation and unresolved targets in dates.rst, dev.rst (two), and the unrelated entry-point section of messages.rst. The documentation build is not reported as passing. No full CLDR-dependent suite or multi-platform test matrix was run locally.

AI disclosure

This contribution was prepared and verified with Hermes Agent. No independent human review is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation for ** in pybabel configs is misleading/confusing

1 participant